#ifndef __SAXIS_H__
#define __SAXIS_H__

#include <souistd.h>
#include <vector>

SNSBEGIN

// Forward declarations
class SAxisValue;

/**
 * @class SAxis
 * @brief Represents chart axis (X or Y)
 */
class  SAxis
{
public:
    SAxis();
    SAxis(const SAxis& other);
    virtual ~SAxis();

    /**
     * @brief Check if axis has lines
     * @return TRUE if axis has lines
     */
    BOOL HasLines() const { return m_bHasLines; }

    /**
     * @brief Set axis lines state
     * @param bHasLines Lines state
     */
    void SetHasLines(BOOL bHasLines) { m_bHasLines = bHasLines; }

    /**
     * @brief Get line color
     * @return Line color
     */
    COLORREF GetLineColor() const { return m_lineColor; }

    /**
     * @brief Set line color
     * @param color Line color
     */
    void SetLineColor(COLORREF color) { m_lineColor = color; }

    /**
     * @brief Get axis name
     * @return Axis name
     */
    SStringT GetName() const { return m_name; }

    /**
     * @brief Set axis name
     * @param name Axis name
     */
    void SetName(const SStringT& name) { m_name = name; }

    /**
     * @brief Check if axis name is enabled
     * @return TRUE if axis name is enabled
     */
    BOOL IsNameEnabled() const { return m_bNameEnabled; }

    /**
     * @brief Set axis name enabled state
     * @param bEnabled Name enabled state
     */
    void SetNameEnabled(BOOL bEnabled) { m_bNameEnabled = bEnabled; }

    /**
     * @brief Get text color
     * @return Text color
     */
    COLORREF GetTextColor() const { return m_textColor; }

    /**
     * @brief Set text color
     * @param color Text color
     */
    void SetTextColor(COLORREF color) { m_textColor = color; }

    /**
     * @brief Get text size
     * @return Text size in pixels
     */
    int GetTextSize() const { return m_textSize; }

    /**
     * @brief Set text size
     * @param size Text size in pixels
     */
    void SetTextSize(int size) { m_textSize = size; }

    /**
     * @brief Get maximum label chars
     * @return Maximum label chars
     */
    int GetMaxLabelChars() const { return m_maxLabelChars; }

    /**
     * @brief Set maximum label chars
     * @param maxChars Maximum label chars
     */
    void SetMaxLabelChars(int maxChars) { m_maxLabelChars = maxChars; }

    /**
     * @brief Check if axis is inside chart area
     * @return TRUE if axis is inside
     */
    BOOL IsInside() const { return m_bInside; }

    /**
     * @brief Set axis inside state
     * @param bInside Inside state
     */
    void SetInside(BOOL bInside) { m_bInside = bInside; }

    /**
     * @brief Check if axis is inverted
     * @return TRUE if axis is inverted
     */
    BOOL IsInverted() const { return m_bInverted; }

    /**
     * @brief Set axis inverted state
     * @param bInverted Inverted state
     */
    void SetInverted(BOOL bInverted) { m_bInverted = bInverted; }

    /**
     * @brief Check if axis is auto generated
     * @return TRUE if axis is auto generated
     */
    BOOL IsAutoGenerated() const { return m_bAutoGenerated; }

    /**
     * @brief Set axis auto generated state
     * @param bAutoGenerated Auto generated state
     */
    void SetAutoGenerated(BOOL bAutoGenerated) { m_bAutoGenerated = bAutoGenerated; }

    /**
     * @brief Get axis values
     * @return Vector of axis values
     */
    const std::vector<SAxisValue*>& GetValues() const { return m_values; }

    /**
     * @brief Set axis values
     * @param values Vector of axis values
     */
    void SetValues(const std::vector<SAxisValue*>& values);

    /**
     * @brief Add axis value
     * @param pValue Pointer to axis value
     */
    void AddValue(SAxisValue* pValue);

    /**
     * @brief Clear all axis values
     */
    void ClearValues();

    /**
     * @brief Get axis value count
     * @return Number of axis values
     */
    size_t GetValueCount() const { return m_values.size(); }

    /**
     * @brief Get axis value at index
     * @param index Value index
     * @return Pointer to axis value or NULL if index is invalid
     */
    SAxisValue* GetValue(size_t index) const;

private:
    BOOL m_bHasLines;
    COLORREF m_lineColor;
    SStringT m_name;
    BOOL m_bNameEnabled;
    COLORREF m_textColor;
    int m_textSize;
    int m_maxLabelChars;
    BOOL m_bInside;
    BOOL m_bInverted;
    BOOL m_bAutoGenerated;
    std::vector<SAxisValue*> m_values;
};

/**
 * @class SAxisValue
 * @brief Represents a value on chart axis
 */
class SAxisValue
{
public:
    SAxisValue();
    SAxisValue(float value);
    SAxisValue(float value, const SStringT& label);
    SAxisValue(const SAxisValue& other);
    virtual ~SAxisValue();

    /**
     * @brief Get axis value
     * @return Axis value
     */
    float GetValue() const { return m_value; }

    /**
     * @brief Set axis value
     * @param value Axis value
     */
    void SetValue(float value) { m_value = value; }

    /**
     * @brief Get axis label
     * @return Axis label
     */
    SStringT GetLabel() const { return m_label; }

    /**
     * @brief Set axis label
     * @param label Axis label
     */
    void SetLabel(const SStringT& label) { m_label = label; }

private:
    float m_value;
    SStringT m_label;
};

SNSEND

#endif // __SAXIS_H__
